<?php
include_once($_SERVER['DOCUMENT_ROOT']."/didongde/conf/dbconfig.php");

function connectDB() {
    $info = new dbconfig();
    try {
        $conn = new PDO($info->get_dbdsn(), $info->get_dbusername(), $info->get_dbpwd());
                //);
    } catch(PDOException $e) {
    echo "ERROR! Cannot connect to PostgreSQL database!";
    echo "<br />".$e->getMessage()."<br />";
    }
    return $conn;
}

function closeDB($conn) {
    if ($conn != null) {    
        $conn = null;
        return 1;
    }
    return 0;
}

?>
